package com.ahucoding.rocket.mcpserver.service;

import org.springframework.ai.tool.annotation.Tool;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicReference;

@Service
public class JdbcService {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Tool(description = "查询数据库所有的表")
    public List<Map<String, Object>> getAllTable() {

        String sql = "select table_name,    table_comment from information_schema.tables where table_schema = database()";
        return jdbcTemplate.queryForList(sql);
    }


}
